package Test2;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        LinkedList
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();//表示数组的大小
        int[] begTime=new int[n];
        int[] endTime=new int[n];
        ArrayList<Integer> ans=new ArrayList<>();
        //int[] hashBut=new int[1000000000];
        for (int i = 0; i < n; i++) {
            begTime[i]=sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            endTime[i]=sc.nextInt();
        }
        for (int j = 0; j < n; j++) {
            for (int k = begTime[j]; k < endTime[j]; k++) {
                //hashBut[k]++;
                if(k > ans.size()){
                    ans.trimToSize();
                }
                ans.set(k, temp++);
            }
        }

        int num= ans.stream().max(((o1, o2) -> o1-o2)).get();
        System.out.println(num+" "+ans.indexOf(num));

    }
}
